\(\int \csc (e+f x) (a+b \sec ^2(e+f x)) \, dx\) [5]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 27 \[ \int \csc (e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=-\frac {(a+b) \text {arctanh}(\cos (e+f x))}{f}+\frac {b \sec (e+f x)}{f} \]

[Out]

-(a+b)*arctanh(cos(f*x+e))/f+b*sec(f*x+e)/f

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {4218, 464, 212} \[ \int \csc (e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=\frac {b \sec (e+f x)}{f}-\frac {(a+b) \text {arctanh}(\cos (e+f x))}{f} \]

[In]

Int[Csc[e + f*x]*(a + b*Sec[e + f*x]^2),x]

[Out]

-(((a + b)*ArcTanh[Cos[e + f*x]])/f) + (b*Sec[e + f*x])/f

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 464

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[c*(e*x)^(m +
 1)*((a + b*x^n)^(p + 1)/(a*e*(m + 1))), x] + Dist[(a*d*(m + 1) - b*c*(m + n*(p + 1) + 1))/(a*e^n*(m + 1)), In
t[(e*x)^(m + n)*(a + b*x^n)^p, x], x] /; FreeQ[{a, b, c, d, e, p}, x] && NeQ[b*c - a*d, 0] && (IntegerQ[n] ||
GtQ[e, 0]) && ((GtQ[n, 0] && LtQ[m, -1]) || (LtQ[n, 0] && GtQ[m + n, -1])) &&  !ILtQ[p, -1]

Rule 4218

Int[((a_) + (b_.)*sec[(e_.) + (f_.)*(x_)]^(n_))^(p_.)*sin[(e_.) + (f_.)*(x_)]^(m_.), x_Symbol] :> With[{ff = F
reeFactors[Cos[e + f*x], x]}, Dist[-ff/f, Subst[Int[(1 - ff^2*x^2)^((m - 1)/2)*((b + a*(ff*x)^n)^p/(ff*x)^(n*p
)), x], x, Cos[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f}, x] && IntegerQ[(m - 1)/2] && IntegerQ[n] && IntegerQ[p
]

Rubi steps \begin{align*} \text {integral}& = -\frac {\text {Subst}\left (\int \frac {b+a x^2}{x^2 \left (1-x^2\right )} \, dx,x,\cos (e+f x)\right )}{f} \\ & = \frac {b \sec (e+f x)}{f}-\frac {(a+b) \text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\cos (e+f x)\right )}{f} \\ & = -\frac {(a+b) \text {arctanh}(\cos (e+f x))}{f}+\frac {b \sec (e+f x)}{f} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(84\) vs. \(2(27)=54\).

Time = 0.07 (sec) , antiderivative size = 84, normalized size of antiderivative = 3.11 \[ \int \csc (e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=-\frac {a \log \left (\cos \left (\frac {e}{2}+\frac {f x}{2}\right )\right )}{f}-\frac {b \log \left (\cos \left (\frac {1}{2} (e+f x)\right )\right )}{f}+\frac {a \log \left (\sin \left (\frac {e}{2}+\frac {f x}{2}\right )\right )}{f}+\frac {b \log \left (\sin \left (\frac {1}{2} (e+f x)\right )\right )}{f}+\frac {b \sec (e+f x)}{f} \]

[In]

Integrate[Csc[e + f*x]*(a + b*Sec[e + f*x]^2),x]

[Out]

-((a*Log[Cos[e/2 + (f*x)/2]])/f) - (b*Log[Cos[(e + f*x)/2]])/f + (a*Log[Sin[e/2 + (f*x)/2]])/f + (b*Log[Sin[(e
 + f*x)/2]])/f + (b*Sec[e + f*x])/f

Maple [A] (verified)

Time = 0.12 (sec) , antiderivative size = 40, normalized size of antiderivative = 1.48

method result size
norman \(-\frac {2 b}{f \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}-1\right )}+\frac {\left (a +b \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}\) \(40\)
parallelrisch \(\frac {\cos \left (f x +e \right ) \left (a +b \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )+b \left (1+\cos \left (f x +e \right )\right )}{f \cos \left (f x +e \right )}\) \(44\)
derivativedivides \(\frac {a \ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )+b \left (\frac {1}{\cos \left (f x +e \right )}+\ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )\right )}{f}\) \(51\)
default \(\frac {a \ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )+b \left (\frac {1}{\cos \left (f x +e \right )}+\ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )\right )}{f}\) \(51\)
risch \(\frac {2 b \,{\mathrm e}^{i \left (f x +e \right )}}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}-1\right ) a}{f}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}-1\right ) b}{f}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+1\right ) a}{f}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+1\right ) b}{f}\) \(100\)

[In]

int(csc(f*x+e)*(a+b*sec(f*x+e)^2),x,method=_RETURNVERBOSE)

[Out]

-2*b/f/(tan(1/2*f*x+1/2*e)^2-1)+(a+b)/f*ln(tan(1/2*f*x+1/2*e))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 60 vs. \(2 (27) = 54\).

Time = 0.25 (sec) , antiderivative size = 60, normalized size of antiderivative = 2.22 \[ \int \csc (e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=-\frac {{\left (a + b\right )} \cos \left (f x + e\right ) \log \left (\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right ) - {\left (a + b\right )} \cos \left (f x + e\right ) \log \left (-\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right ) - 2 \, b}{2 \, f \cos \left (f x + e\right )} \]

[In]

integrate(csc(f*x+e)*(a+b*sec(f*x+e)^2),x, algorithm="fricas")

[Out]

-1/2*((a + b)*cos(f*x + e)*log(1/2*cos(f*x + e) + 1/2) - (a + b)*cos(f*x + e)*log(-1/2*cos(f*x + e) + 1/2) - 2
*b)/(f*cos(f*x + e))

Sympy [F]

\[ \int \csc (e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=\int \left (a + b \sec ^{2}{\left (e + f x \right )}\right ) \csc {\left (e + f x \right )}\, dx \]

[In]

integrate(csc(f*x+e)*(a+b*sec(f*x+e)**2),x)

[Out]

Integral((a + b*sec(e + f*x)**2)*csc(e + f*x), x)

Maxima [A] (verification not implemented)

none

Time = 0.19 (sec) , antiderivative size = 44, normalized size of antiderivative = 1.63 \[ \int \csc (e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=-\frac {{\left (a + b\right )} \log \left (\cos \left (f x + e\right ) + 1\right ) - {\left (a + b\right )} \log \left (\cos \left (f x + e\right ) - 1\right ) - \frac {2 \, b}{\cos \left (f x + e\right )}}{2 \, f} \]

[In]

integrate(csc(f*x+e)*(a+b*sec(f*x+e)^2),x, algorithm="maxima")

[Out]

-1/2*((a + b)*log(cos(f*x + e) + 1) - (a + b)*log(cos(f*x + e) - 1) - 2*b/cos(f*x + e))/f

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 60 vs. \(2 (27) = 54\).

Time = 0.28 (sec) , antiderivative size = 60, normalized size of antiderivative = 2.22 \[ \int \csc (e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=\frac {{\left (a + b\right )} \log \left (\frac {{\left | -\cos \left (f x + e\right ) + 1 \right |}}{{\left | \cos \left (f x + e\right ) + 1 \right |}}\right ) + \frac {4 \, b}{\frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1} + 1}}{2 \, f} \]

[In]

integrate(csc(f*x+e)*(a+b*sec(f*x+e)^2),x, algorithm="giac")

[Out]

1/2*((a + b)*log(abs(-cos(f*x + e) + 1)/abs(cos(f*x + e) + 1)) + 4*b/((cos(f*x + e) - 1)/(cos(f*x + e) + 1) +
1))/f

Mupad [B] (verification not implemented)

Time = 0.10 (sec) , antiderivative size = 29, normalized size of antiderivative = 1.07 \[ \int \csc (e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=\frac {b}{f\,\cos \left (e+f\,x\right )}-\frac {\mathrm {atanh}\left (\cos \left (e+f\,x\right )\right )\,\left (a+b\right )}{f} \]

[In]

int((a + b/cos(e + f*x)^2)/sin(e + f*x),x)

[Out]

b/(f*cos(e + f*x)) - (atanh(cos(e + f*x))*(a + b))/f